﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class TSVA09
    {
     
        public TSVA09()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            MV = new VVAFARBEN();
            DataContext = MV;  
            InitializeComponent();  
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            dwVF = dwMaster;
            if (dwMaster != null)
            {
                FARBGRP = dwMaster["VAFFARBGRP"].ToString();
                PRART = dwMaster["VAAARTST"].ToString().PadRight(1) + TMV.VAFPART + TMV.VAFPVAR.PadRight(3) + TMV.VAFFFARBE + TMV.VAFBESCHICH + TMV.VAFDESS + TMV.VAFCOLORIT + TMV.VAFPGROE;
                KEY = dwMaster["VAFKOLL"].ToString() + dwMaster["VAFART"].ToString() + dwMaster["VAFFARBE"].ToString();
                TXTISIND = KEY.PadRight(60);
            }
            else
            {
                PRART = "";
                KEY = "";
                TXTISIND = "";
            }
        }
        public override void OnVARTChg(string value)
        {
            TBMain.Clear();
            if (value.Length<29)
                return;
            dwData = TBMain.NewRow();
            dwData["VAFMANDANT"] = app.Mandant;
            dwData["VAFKOLL"] = value.Substring(0,5);
            dwData["VAFART"] = value.Substring(5, 24);
            SResult = TMV.QVAF_1(dwData);
            MergeData(SResult, false);
            base.OnVARTChg(value);
        }  
         
        
    }
}
